#define _CRT_SECURE_NO_WARNINGS 1

#include"Sort.h"

void Print(int *a ,int n)
{
	for (int i = 0; i < n; i++)
	{
		printf("%d ", a[i]);
	}
	printf("\n");
}

void TestInsertSort()
{
	int arr[] = { 2,90,30,891,4,74,33,27,1,9,43,2,7 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	
	Print(arr, sz);
	InsertSort(arr, sz);
	Print(arr, sz);
}

void TestShellSort()
{
	int arr[] = { 2,90,30,891,4,74,33,27,1,9,43,2,7 };
	int sz = sizeof(arr) / sizeof(arr[0]);

	Print(arr, sz);
	ShellSort(arr, sz);
	Print(arr, sz);

}

void TestSelectSort()
{
	int arr[] = { 2,90,30,891,4,74,33,27,1,9,43,2,7 };
	int sz = sizeof(arr) / sizeof(arr[0]);

	Print(arr, sz);
	SelectSort( arr,  sz);
	Print(arr, sz);
}

void TestHeapSort()
{
	int arr[] = { 2,90,30,891,4,74,33,27,1,9,43,2,7 };
	int sz = sizeof(arr) / sizeof(arr[0]);

	Print(arr, sz);
	HeapSort(arr, sz);
	Print(arr, sz);
}

void TestBubbleSort()
{
	int arr[] = { 2,90,30,891,4,74,33,27,1,9,43,2,7 };
	int sz = sizeof(arr) / sizeof(arr[0]);

	Print(arr, sz);
	BubbleSort(arr, sz);
	Print(arr, sz);
}

void TestQuickSort()
{
	int arr[] = { 2,90,30,891,4,74,33,27,1,9,43,2,7 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	Print(arr, sz);
	QuickSort(arr, 0, sz - 1);
	Print(arr, sz);
}

void TestQuickSortNonR()
{
	int arr[] = { 2,90,30,891,4,74,33,27,1,9,43,2,7 };
	int sz = sizeof(arr) / sizeof(arr[0]);

	Print(arr, sz);
	QuickSortNonR(arr, 0, sz - 1);
	Print(arr, sz);
}

void TestMergeSort()
{
	int arr[] = { 2,90,30,891,4,74,33,27,1,9,43,2,7 };
	int sz = sizeof(arr) / sizeof(arr[0]);

	Print(arr, sz);
	MergeSort(arr, sz);
	Print(arr, sz);
}

void TestCountSort()
{
	int arr[] = { 2,90,30,891,4,74,33,27,1,9,43,2,7 };
	int sz = sizeof(arr) / sizeof(arr[0]);

	Print(arr, sz);
	CountSort(arr, sz);
	Print(arr, sz);
}

int main()
{
	//TestInsertSort();
	//TestShellSort();
	//TestSelectSort();
	//TestHeapSort();
	//TestBubbleSort();
	//TestQuickSort();
	//TestQuickSortNonR();

	//TestMergeSort();
	TestCountSort();

	return 0;
}
